/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test1;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Costel
 */
@Entity
@Table(name = "terenuri")
@NamedQueries({@NamedQuery(name = "Teren.findAll", query = "SELECT t FROM Teren t"), @NamedQuery(name = "Teren.findById", query = "SELECT t FROM Teren t WHERE t.id = :id"), @NamedQuery(name = "Teren.findByVersion", query = "SELECT t FROM Teren t WHERE t.version = :version"), @NamedQuery(name = "Teren.findBySuprafataDomiciliu", query = "SELECT t FROM Teren t WHERE t.suprafataDomiciliu = :suprafataDomiciliu"), @NamedQuery(name = "Teren.findBySuprafataAlteLocalitati", query = "SELECT t FROM Teren t WHERE t.suprafataAlteLocalitati = :suprafataAlteLocalitati"), @NamedQuery(name = "Teren.findBySuprafataIntravilan", query = "SELECT t FROM Teren t WHERE t.suprafataIntravilan = :suprafataIntravilan"), @NamedQuery(name = "Teren.findBySuprafataExtravilan", query = "SELECT t FROM Teren t WHERE t.suprafataExtravilan = :suprafataExtravilan"), @NamedQuery(name = "Teren.findBySuprafataTotal", query = "SELECT t FROM Teren t WHERE t.suprafataTotal = :suprafataTotal"), @NamedQuery(name = "Teren.findByCategorieCod", query = "SELECT t FROM Teren t WHERE t.categorieCod = :categorieCod")})
public class Teren implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Column(name = "VERSION")
    private BigInteger version;
    @Basic(optional = false)
    @Column(name = "suprafataDomiciliu")
    private double suprafataDomiciliu;
    @Basic(optional = false)
    @Column(name = "suprafataAlteLocalitati")
    private double suprafataAlteLocalitati;
    @Basic(optional = false)
    @Column(name = "suprafataIntravilan")
    private double suprafataIntravilan;
    @Basic(optional = false)
    @Column(name = "suprafataExtravilan")
    private double suprafataExtravilan;
    @Basic(optional = false)
    @Column(name = "suprafataTotal")
    private double suprafataTotal;
    @Column(name = "categorieCod")
    private Integer categorieCod;
    @JoinColumn(name = "TITULAR_ID", referencedColumnName = "ID")
    @ManyToOne(fetch = FetchType.EAGER)
    private Titulari titularId;
    @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Titulari titulari;

    public Teren() {
    }

    public Teren(Long id) {
        this.id = id;
    }

    public Teren(Long id, double suprafataDomiciliu, double suprafataAlteLocalitati, double suprafataIntravilan, double suprafataExtravilan, double suprafataTotal) {
        this.id = id;
        this.suprafataDomiciliu = suprafataDomiciliu;
        this.suprafataAlteLocalitati = suprafataAlteLocalitati;
        this.suprafataIntravilan = suprafataIntravilan;
        this.suprafataExtravilan = suprafataExtravilan;
        this.suprafataTotal = suprafataTotal;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigInteger getVersion() {
        return version;
    }

    public void setVersion(BigInteger version) {
        this.version = version;
    }

    public double getSuprafataDomiciliu() {
        return suprafataDomiciliu;
    }

    public void setSuprafataDomiciliu(double suprafataDomiciliu) {
        this.suprafataDomiciliu = suprafataDomiciliu;
    }

    public double getSuprafataAlteLocalitati() {
        return suprafataAlteLocalitati;
    }

    public void setSuprafataAlteLocalitati(double suprafataAlteLocalitati) {
        this.suprafataAlteLocalitati = suprafataAlteLocalitati;
    }

    public double getSuprafataIntravilan() {
        return suprafataIntravilan;
    }

    public void setSuprafataIntravilan(double suprafataIntravilan) {
        this.suprafataIntravilan = suprafataIntravilan;
    }

    public double getSuprafataExtravilan() {
        return suprafataExtravilan;
    }

    public void setSuprafataExtravilan(double suprafataExtravilan) {
        this.suprafataExtravilan = suprafataExtravilan;
    }

    public double getSuprafataTotal() {
        return suprafataTotal;
    }

    public void setSuprafataTotal(double suprafataTotal) {
        this.suprafataTotal = suprafataTotal;
    }

    public Integer getCategorieCod() {
        return categorieCod;
    }

    public void setCategorieCod(Integer categorieCod) {
        this.categorieCod = categorieCod;
    }

    public Titulari getTitularId() {
        return titularId;
    }

    public void setTitularId(Titulari titularId) {
        this.titularId = titularId;
    }

    public Titulari getTitulari() {
        return titulari;
    }

    public void setTitulari(Titulari titulari) {
        this.titulari = titulari;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Teren)) {
            return false;
        }
        Teren other = (Teren) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "test1.Teren[id=" + id + "]";
    }

}
